{extend name="public/base" /}

{block name="title"}
<title>楼盘信息</title>
{/block}

{block name="pjax_container"}
<section class="content-header">
    <h1>楼盘信息</h1>
    <ol class="breadcrumb">
        <li class="active"><i class="fa fa-dashboard"></i> 楼盘信息</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <form class="form-horizontal" method="POST" action="{:url('reward_edit')}" onsubmit="return false" >
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="pull-right"><a href="javascript:history.back(-1)" class="btn btn-sm" style="padding:10px 2px;"> </a></li>
                    </ul>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">公益说明</label>
                        <div class="col-sm-7"><input class="form-control" type="text" name="benefit_desc" value="{$data.benefit_desc}"/></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">公益详情</label>
                        <div class="col-sm-7">
                            <textarea name="benefit_content" cols="133" rows="8">{$data.benefit_content}</textarea>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">健康奖说明</label>
                        <div class="col-sm-7"><input class="form-control" type="text" name="healthy_desc" value="{$data.healthy_desc}"/></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">健康奖详情</label>
                        <div class="col-sm-7">
                            <textarea name="healthy_content" cols="133" rows="8">{$data.healthy_content}</textarea>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">排行奖说明</label>
                        <div class="col-sm-7"><input class="form-control" type="text" name="ranking_desc" value="{$data.ranking_desc}"/></div>
                    </div>







                    <div class="form-group">
                        <label class="col-sm-2 control-label">排行榜奖励详情</label>
                        <div class="col-sm-7" id="rankings">
                            {foreach name="$data['ranking_content']" item="vo"}
                                <div style="margin-bottom:10px;">
                                    <input class="form-control" type="text" name="ranking_title[]" value="{$vo[0]}" placeholder="名次" style="width:150px;display:inline-block;"/>-
                                    <input class="form-control" type="text" name="ranking_des[]" value="{$vo[1]}" placeholder="奖励说明" style="width:700px;display:inline-block;"/>
                                    <a href="javascript:;" onclick="remove_ranking(this)">删除名次</a>
                                </div>
                            {/foreach}
                            <a href="javascript:;" onclick="add_ranking(this)">添加奖励名次</a>
                        </div>
                        <div id="add_ranking" style="display:none;">
                            <div style="margin-bottom:10px;">
                                <input class="form-control" type="text" name="ranking_title[]" value="" placeholder="名次" style="width:150px;display:inline-block;"/>-
                                <input class="form-control" type="text" name="ranking_des[]" value="" placeholder="奖励说明" style="width:700px;display:inline-block;"/>
                                <a href="javascript:;" onclick="remove_ranking(this)">删除名次</a>
                            </div>
                        </div>
                    </div>









                    <div class="form-group">
                        <label class="col-sm-2 control-label">参与奖励说明</label>
                        <div class="col-sm-7"><input class="form-control" type="text" name="part_desc" value="{$data.part_desc}"/></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">参与奖励详情</label>
                        <div class="col-sm-7">
                            <textarea name="part_content" cols="133" rows="8">{$data.part_content}</textarea>
                        </div>
                    </div>

                    <div class="box-footer">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-7">
                            <div class="btn-group pull-right">
                                <button type="submit" class="btn btn-info pull-right submits" data-loading-text="&lt;i class='fa fa-spinner fa-spin '&gt;&lt;/i&gt; 提交">提交</button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</section>
<script type="application/javascript">
    KindEditor.create('textarea[name="benefit_content"]',{
        width : '100%',   //宽度
        height : '320px',   //高度
        resizeType : '0',   //禁止拖动
        allowFileManager : false,   //允许对上传图片进行管理
        uploadJson : '{:url("File/kind_editor_upload")}',   //文件上传地址
        urlType : 'domain',   //带域名的路径
        formatUploadUrl: true,   //自动格式化上传后的URL
        autoHeightMode: false,   //开启自动高度模式
        afterBlur: function () { this.sync(); }   //同步编辑器数据
    });

    KindEditor.create('textarea[name="healthy_content"]',{
        width : '100%',   //宽度
        height : '320px',   //高度
        resizeType : '0',   //禁止拖动
        allowFileManager : false,   //允许对上传图片进行管理
        uploadJson : '{:url("File/kind_editor_upload")}',   //文件上传地址
        urlType : 'domain',   //带域名的路径
        formatUploadUrl: true,   //自动格式化上传后的URL
        autoHeightMode: false,   //开启自动高度模式
        afterBlur: function () { this.sync(); }   //同步编辑器数据
    });

    KindEditor.create('textarea[name="part_content"]',{
        width : '100%',   //宽度
        height : '320px',   //高度
        resizeType : '0',   //禁止拖动
        allowFileManager : false,   //允许对上传图片进行管理
        uploadJson : '{:url("File/kind_editor_upload")}',   //文件上传地址
        urlType : 'domain',   //带域名的路径
        formatUploadUrl: true,   //自动格式化上传后的URL
        autoHeightMode: false,   //开启自动高度模式
        afterBlur: function () { this.sync(); }   //同步编辑器数据
    });

    var ranking_html = $('#add_ranking').html();
    // 添加奖励名次
    function add_ranking(obj){
        $(obj).before(ranking_html);
    }

    // 删除名次
    function remove_ranking(obj){
        $(obj).parent().remove();
    }
</script>
{/block}